package com.kehutong.charge.app;

import com.kehutong.charge.service.ChargeArrearsService;
import com.kehutong.common.errcode.Result;
import com.kehutong.common.util.Token;
import org.coraframework.authz.HasPermission;
import org.coraframework.inject.Inject;
import org.coraframework.json.JSONObject;
import org.coraframework.mvc.MvcAction;
import org.coraframework.mvc.http.ReqMapping;

/**
 * 欠费接口
 * @Author jian Ye
 * 2021-08-25
 */
@MvcAction
@ReqMapping("/kht-bin/charges/arrears")
public class ChargeArrearsAction {

    @Inject
    ChargeArrearsService chargeArrearsService;



    /**
     * 根据住户分组统计欠费分页
     */
    @ReqMapping("/resident/statist/page")
    public Object residentStatistPage(JSONObject jsonObject,Token token) throws Exception {
        return chargeArrearsService.residentStatistPage(jsonObject,token);
    }


    /**
     * 根据住户获取欠费详情和列表
     */
    @ReqMapping("/resident/details/list")
    public Object residentDetailsList(JSONObject jsonObject) {
        return chargeArrearsService.residentDetailsList(jsonObject);
    }


    /**
     * 根据住户获取欠费账单列表
     */
    @ReqMapping("/resident/item/list")
    public Object itemDetailsList(JSONObject jsonObject) {
        return chargeArrearsService.itemDetailsList(jsonObject);
    }


    /**
     * 小程序-我的-总欠费金额
     * @param jsonObject
     * @return
     */
    @ReqMapping("/total")
    public Object totalUserArrears(JSONObject jsonObject) {
        return chargeArrearsService.totalUserArrears(jsonObject);
    }


    /**
     * 企微跟据住户ID批量催费
     * @param jsonObject residentIds 欠费住户的ID列表 {"residentIds":["162337571772780780","..."]}
     * @return
     */
    @ReqMapping("/batch/urging")
    public Object batchUrgingByResidentIds(JSONObject jsonObject,Token token) throws Exception {
        chargeArrearsService.batchUrgingByResidentIds(jsonObject,token);
        return Result.success();
    }
}
